package com.nyt.org.modules.api.constant;

import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

public class Methods {

    private static Map<String,String> instance = null;

    /**
     * 判断传入的参数是否在接口信息中
     * @param key
     * @return
     */
    public static Boolean exist(String key) {
        if (!StringUtils.isBlank(key)){
            return instance.keySet().contains(key);
        }
        return false;
    }

    /**
     * 获取同步方法
     *
     * @return
     */
    public static Map<String, String> syncMethod() {
        Map<String, String> target = new HashMap<>();
        instance.keySet().forEach(key -> {
            if (key.startsWith("sync"))
                target.put(key, instance.get(key));
        });
        return target;
    }
    

    static {
        instance = new HashMap(){{
            put("zhonglv.station.query","售票站点获取");
            put("zhonglv.busplan.query","车次信息查询");
            put("zhonglv.lock.seat","下单锁座接口");
            put("zhonglv.ticket.out","出票接口");
            put("zhonglv.order.cancel","订单取消");
        }};

    }
}
